//
//  detailheaderFindCell.m
//  HubeiHotel
//
//  Created by LiBenCan on 17/11/17.
//  Copyright © 2017年 张露杰. All rights reserved.
//

#import "detailheaderFindCell.h"
#import "ChooseBtnFindView.h"
@implementation detailheaderFindCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self setUpUI];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

- (void)setUpUI
{
    //图片
    _producImageV = [UIImageView new];
    [self.contentView addSubview:_producImageV];
    [_producImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(15*screenW_6));
        make.top.equalTo(@(17*screenW_6));
        make.height.equalTo(@(56.5* screenW_6));
        make.width.equalTo(@(56.5* screenW_6));
    }];
    [_producImageV.layer setCornerRadius:28.25*screenW_6];
    _producImageV.layer.masksToBounds = YES;
    
    //名字
    _nameLab = [UILabel new];
    _nameLab.textColor = [UIColor colorWithHexString:@"333333"];
    _nameLab.font = [UIFont systemFontOfSize:17];
    _nameLab.textAlignment = NSTextAlignmentLeft;
    _nameLab.text = @"jnnn";
    _nameLab.numberOfLines = 0;
    [self.contentView  addSubview:_nameLab];
    [_nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_producImageV.mas_right).offset(10*screenW_6);
        make.top.equalTo(_producImageV.mas_top).offset(0);
        make.right.equalTo(self.contentView ).offset(-10*screenW_6);
        make.height.equalTo(@(25));
    }];
    
    //描述 规格
    _describLab = [UILabel new];
    _describLab.textColor = [UIColor colorWithHexString:@"#999999"];
    _describLab.font = [UIFont systemFontOfSize:11.0];
    _describLab.textAlignment = NSTextAlignmentLeft;
    _describLab.text = @"www";
    _describLab.numberOfLines = 0;
    [self.contentView  addSubview:_describLab];
    [_describLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_producImageV.mas_right).offset(10*screenW_6);
        make.right.equalTo(self.contentView ).offset(-10*screenW_6);
        make.top.equalTo(_nameLab.mas_bottom).offset(0*screenW_6);
        make.height.equalTo(@(15));
    }];
    
    
    //价格
    _needLab = [UILabel new];
    _needLab.textColor = [UIColor colorWithHexString:@"#ff6900"];
    _needLab.font = [UIFont systemFontOfSize:11.0];
    _needLab.textAlignment = NSTextAlignmentLeft;
    _needLab.text = @"wwwww";
    [self.contentView  addSubview:_needLab];
    [_needLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_producImageV.mas_right).offset(10*screenW_6);
        make.height.equalTo(@(15));
        make.top.equalTo(_describLab.mas_bottom).offset(0);
        make.right.equalTo(self.contentView ).offset(-10*screenW_6);
    }];
    
    //画线
    _lineLab = [UILabel new];
    _lineLab.backgroundColor = LineColor;
    _lineLab.text = @" ";
    [self.contentView  addSubview:_lineLab];
    [_lineLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.right.equalTo(@0);
        make.height.equalTo(@1);
        make.top.equalTo(_producImageV.mas_bottom).offset(17*screenW_6);
    }];
    
    //选择按钮
    _chooseBtnV = [[ChooseBtnFindView alloc]initWithFrame:CGRectZero TitleArr:@[@"公司主页",@"招聘职位"]];
    [self.contentView addSubview:_chooseBtnV];
    [_chooseBtnV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.right.equalTo(@0);
        make.height.equalTo(@(40*screenW_6));
        make.top.equalTo(_lineLab.mas_bottom).offset(0*screenW_6);
        make.bottom.equalTo(self.contentView).offset(0);
    }];
    __weak typeof(self)weakSelf = self;
    _chooseBtnV.chooseBtnBlock = ^(NSInteger tagNumber)
    {   //按钮选择的回调
        if (weakSelf.chooseMainBlock) {
            weakSelf.chooseMainBlock(tagNumber);
        }
    };
    
}

-(void)setDataDic:(NSDictionary *)dataDic
{
    _nameLab.text = dataDic[@"name"];
    _describLab.text = dataDic[@"address"];
    _needLab.text = [NSString stringWithFormat:@"%@个 在招聘岗位",dataDic[@"positionCount"]];
    [_needLab setHighlightStirng:[NSString stringWithFormat:@"%@个",dataDic[@"positionCount"]] HighlightColor:[UIColor colorWithHexString:@"#ff6900"]];
    [_producImageV sd_setImageWithURL:[NSURL URLWithString:dataDic[@"logo"]] placeholderImage:nil];
}

@end
